package com.practice.exercise.service.impl;

import com.practice.exercise.dao.StudentMapper;
import com.practice.exercise.domain.User;
import com.practice.exercise.service.StudentInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class StudentInfoServiceImpl implements StudentInfoService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public User findByStudentId(Integer student_id) {
        return studentMapper.findStudentById(student_id);
    }

    @Override
    public void insertStudent(User student) {
        studentMapper.insertStudent(student);
    }

    @Override
    public List<User> findAllStudent() {
        return studentMapper.findAllStudent();
    }

    @Override
    public void deleteStudentById(Integer student_id) {
        studentMapper.deleteStudentById(student_id);
    }

    @Override
    public void UpdateStudentById(User student) {
        studentMapper.updateStudentInfo(student);
    }
}
